﻿using System;
using System.Collections.Generic;
using VisitorExample.Fruits;

namespace VisitorExample
{
    class Program
    {
        static void Main(string[] args)
        {
            var fruits = new List<Fruit>();

            var ban = new Banana();
            ban.Price = 1.55d;

            var ap = new Apple();
            ap.Price = 0.45d;

            fruits.Add(ban);
            fruits.Add(ap);

            var priceVisitor = new FruitPriceVisitor();

            foreach (var item in fruits)
            {
                item.Accept(priceVisitor);
            }

            Console.WriteLine("Full Price of Fruits: {0}", priceVisitor.Sum);
            Console.ReadLine();
        }
    }
}
